package models

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Username string `gorm:"type:varchar(30)" json:"username"`
	Password string `gorm:"type:varchar(255)" json:"password"`
}
type Nov struct {
	gorm.Model
	Title        string `gorm:"type:varchar(30)" json:"title"`
	Content      string `gorm:"type:varchar(30)" json:"content"`
	Author       string `gorm:"type:varchar(30)" json:"author"`
	UserID       int    `gorm:"type:int" json:"user_id"`
	User         User   `gorm:"foreignKey:UserID" json:"user"`
	CommentCount int    `gorm:"type:int" json:"comment_count"`
}

type Comment struct {
	gorm.Model
	Content string `gorm:"type:varchar(30)" json:"content"`
	UserID  int    `gorm:"type:int" json:"user_id"`
	User    User   `gorm:"foreignKey:UserID" json:"user"`
	NovID   int    `gorm:"type:int" json:"nov_id"`
	Nov     Nov    `gorm:"foreignKey:NovID" json:"nov"`
}
